/**  
*
* <p>WebConfiguration.java</p>  
* <p>Copyright: Copyright (c) 2020</p>  
* <p>Company: http://www.richfit.com/</p>  
* @author hushouquan
* @date 2020年4月1日  
* @version 1.0  
*/  
package com.rf.richfitwheel.admin.conf;

import java.util.List;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.mobile.device.DeviceHandlerMethodArgumentResolver;
import org.springframework.mobile.device.DeviceResolverHandlerInterceptor;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**  
* webmvc拦截器配置，需要加拦截器的可以在这儿配置
* @author hushouquan
* @date 2020年4月1日  
*/
@Configuration
public class WebConfiguration implements WebMvcConfigurer {
	
	@Bean
	public DeviceResolverHandlerInterceptor
	        deviceResolverHandlerInterceptor() {
	    return new DeviceResolverHandlerInterceptor();
	}

	@Bean
	public DeviceHandlerMethodArgumentResolver
	        deviceHandlerMethodArgumentResolver() {
	    return new DeviceHandlerMethodArgumentResolver();
	}

	@Override
	public void addInterceptors(InterceptorRegistry registry) {
	    registry.addInterceptor(deviceResolverHandlerInterceptor());
	}

	@Override
	public void addArgumentResolvers(
	        List<HandlerMethodArgumentResolver> argumentResolvers) {
	    argumentResolvers.add(deviceHandlerMethodArgumentResolver());
	}
}
